#include "frienditem.h"
#include "ui_frienditem.h"
#include <QPainter>
FriendItem::FriendItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FriendItem)
{
    ui->setupUi(this);
}

FriendItem::~FriendItem()
{
    delete ui;
}

void FriendItem::Set(QString HeadPic, QString Name, QString Sign, int Status, int Div)
{
    div=Div;
    ui->Headpic->setText(HeadPic);
    ui->Name->setText(Name);
    ui->Sign->setText(Sign);
    ui->status->setText(Status?"在线":"下线");
}

int FriendItem::getDiv()
{
    return div;
}


void FriendItem::paintEvent(QPaintEvent* event) {
    QWidget::paintEvent(event);
    // 绘制 hover 效果（鼠标悬浮时背景变色）
    QStyleOption opt;
    opt.initFrom(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

